import request from '@/utils/request'

//获取用户信息
export function getUserInfo(id) {
  return request({
    url: `user-service/user/${id}`,
    method: 'get',
  })
}


export function logout() {
  return request({
    url: 'vue-admin-template/user/logout',
    method: 'post'
  })
}
//人员列表
export function getUserList(pageIndex,pageSize,userName) {
  return request({
    url: `user-service/user/search`,
    method: 'get',
    params: {
      pageIndex,pageSize,userName
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}
//人员类型  运维人员 运营人员
export function getUserType() {
  return request({
    url: `user-service/role`,
    method: 'get',
  })
}
//负责区域 列表
export function getRegionList() {
  return request({
    url: `vm-service/region/search`,
    method: 'get',
    params: {
      pageIndex:1,pageSize:10000
    }
  })
}
//新增人员
export function addUser(data) {
  return request({
    url: `user-service/user`,
    method: 'post',
    data,
  })
}
//修改人员
export function changeUser(data,id) {
  return request({
    url: `user-service/user/${id}`,
    method: 'put',
    data,
  })
}
//删除人员
export function delUser(id) {
  return request({
    url: `user-service/user/${id}`,
    method: 'delete',
  })
}
//工单数量列表
export function getWorkList(pageIndex,pageSize,userName,isRepair) {
  return request({
    url: `user-service/user/searchUserWork`,
    method: 'get',
    params: {
      pageIndex,pageSize,userName,isRepair
    },
    contentType : "application/x-www-form-urlencoded; charset=utf-8"
  })
}

//详情
export function workDetail(userId) {
  return request({
    url: `user-service/user/${userId}`,
    method: 'get',
  })
}
//根据时间查询 本周 本月 本年
export function taskNumDetail(userId,start,end) {
  return request({
    url: `task-service/task/userWork`,
    method: 'get',
    params: {
      userId,start,end
    }
  })
}
// 获取工单数据
export const getWorkOrder = ({ start, end }) => {
  return request({
    url: `task-service/task/taskReportInfo/${start}/${end}`
  })
}
// 工单状态统计
export const getWorkStatusCount = ({ start, end }) => {
  return request({
    url: `task-service/task/collectReport/${start}/${end}`
  })
}
// 获取区域列表
export const getRegionList1 = (params) => {
  return request({
    url: 'vm-service/region/search',
    params
  })
}
// 销售冠军
export const getTop10Worker = ({ start, end, regionId, isRepair }) => {
  return request({
    url: `task-service/task/userWorkTop10/${start}/${end}/${isRepair}/${regionId}`
  })
}